Cover | TOC | Chap | Prev Chap | Prev Fig | Next Fig | Next Chap |
|
Figure 24.4
Four keys on a virtual keyboard. |
|
Click on the image to view the VRML scene. |
#VRML V2.0 utf8 # The VRML 2.0 Sourcebook # Copyright (c) 1997 # Andrea L. Ames, David R. Nadeau, and John L. Moreland Group { children [ # Middle C (C4) Transform { children [ DEF WhiteKey Shape { appearance Appearance { material Material { } } geometry Box { size 0.23 0.1 1.5 } }, DEF C4 TouchSensor { }, Sound { source DEF PitchC4 AudioClip { url "tone1.wav" pitch 1.0 } } ] }, # C# above middle C (Cs4) Transform { translation 0.125 0.1 -0.375 children [ DEF BlackKey Shape { appearance Appearance { material Material { diffuseColor 0.4 0.4 0.4 } } geometry Box { size 0.2 0.1 0.75 } }, DEF Cs4 TouchSensor { } Sound { source DEF PitchCs4 AudioClip { url "tone1.wav" pitch 1.059 } } ] }, # D above middle C (D4) Transform { translation 0.25 0.0 0.0 children [ USE WhiteKey, DEF D4 TouchSensor { } Sound { source DEF PitchD4 AudioClip { url "tone1.wav" pitch 1.122 } } ] }, # D# above middle C (Ds4) Transform { translation 0.375 0.1 -0.375 children [ USE BlackKey, DEF Ds4 TouchSensor { } Sound { source DEF PitchDs4 AudioClip { url "tone1.wav" pitch 1.189 } } ] } ] } ROUTE C4.touchTime TO PitchC4.set_startTime ROUTE Cs4.touchTime TO PitchCs4.set_startTime ROUTE D4.touchTime TO PitchD4.set_startTime ROUTE Ds4.touchTime TO PitchDs4.set_startTime